package com.example.lc.mydoubledisplay;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

/**
 * 广告页面
 */
public class GuangGao extends PresentationFragment implements View.OnClickListener {
    private Button btn_ceshi;
    private ImageView iv_content;

    public static GuangGao welcome(Context ctxt, Display display) {
        GuangGao frag = new GuangGao();
        frag.setDisplay(ctxt, display);
        return (frag);
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View result = inflater.inflate(R.layout.display_guang_gao, container, false);
        initView(result);
        return result;
    }

    private void initView(View result) {
        btn_ceshi = (Button) result.findViewById(R.id.btn_ceshi);
        btn_ceshi.setOnClickListener(this);
        iv_content = (ImageView) result.findViewById(R.id.iv_content);
        iv_content.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_ceshi:
                iv_content.setVisibility(View.GONE);
                Toast.makeText(getActivity(),"为什么按钮无法点击",Toast.LENGTH_SHORT).show();
                Log.e("GuangGao","为什么按钮无法点击");
                break;
            case R.id.iv_content:
                iv_content.setVisibility(View.GONE);
                Toast.makeText(getActivity(),"为什么图片无法点击",Toast.LENGTH_SHORT).show();
                Log.e("GuangGao","为什么图片无法点击");
                break;
        }
    }
}
